package com.smalluz.ad.modules.ks.api.impl;

import java.util.Objects;

import com.smalluz.ad.modules.common.enums.MediaApiUrl;
import com.smalluz.ad.modules.ks.api.KsCampaignService;
import com.smalluz.ad.modules.ks.api.KsService;
import com.smalluz.ad.modules.ks.bean.KsCampaignPageRequest;
import com.smalluz.ad.modules.ks.result.KsCampaignListResult;

import lombok.RequiredArgsConstructor;

@RequiredArgsConstructor
public class KsCampaignServiceImpl implements KsCampaignService {
    private final KsService ksService;

    @Override
    public KsCampaignListResult getCampaignPage(KsCampaignPageRequest request) {
        String responseContent = ksService.get(MediaApiUrl.KsCampaignUrl.CAMPAIGN_OPEN_API_PAGE_LIST, request);
        return KsCampaignListResult.fromJson(Objects.requireNonNull(responseContent));

    }

}
